# -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 10:55:13 2012

@author: nzhao
"""
from phy.spin.SingleSpin import SingleSpin

elements = {'C': 'C13'}

def readfile(filename):
    fi = open(filename, 'r')
    
    spin_list = []
    for line in fi:
        items = line.split()
        if items[0] in elements:
            spin_list.append( SingleSpin(element=elements[items[0]], \
                                        spin_type = 'Bath',  \
                                        x = float(items[1]), \
                                        y = float(items[2]), \
                                        z = float(items[3]), ) \
                            )
    fi.close()
    return spin_list